#!/usr/bin/env python
import os

def main():
#    assert(os.path.exists("bashrc"),"bashrc not exist")
#    assert(os.path.exists("vimrc"),"vimrc not exist")
    src = os.path.realpath("bashrc")
    vimrc = os.path.realpath("vimrc")
    home = os.path.expanduser('~')
    os.chdir(home)
    if not os.path.exists(".mybashrc"):
        os.symlink(src , ".mybashrc")
    if os.path.exists(".vimrc"):
        os.rename(".vimrc",".vimrc_bk")
    print ( "changing .vimrc to .vimrc_bk")
    os.symlink(vimrc,".vimrc")
    rcfile = open(".bashrc", "a")
    rcfile.write("""
# MY custom rc file
if [ -f ~/.mybashrc ] ; then
    . ~/.mybashrc
fi
""")

if __name__ == "__main__":
    main()
